//
//  PushViewController.m
//  06-UINavigationController
//
//  Created by 曹曹 on 16/7/21.
//  Copyright © 2016年 曹曹. All rights reserved.
//

#import "PushViewController.h"

@interface PushViewController ()

@end

@implementation PushViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.backgroundColor = [UIColor greenColor];
    button.frame = CGRectMake(100, 100, 200, 100);
    [button addTarget:self action:@selector(goBack:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
}

- (void)goBack:(UIButton *)button {
    NSLog(@"%@", self.navigationController.viewControllers);
    // 当前ViewController出栈, 返回上一级
    [self.navigationController popViewControllerAnimated:YES];
    // 返回根视图, 返回根视图控制器
    // [self.navigationController popToRootViewControllerAnimated:YES];
    // 返回指定的视图控制器
    // self.navigationController popToViewController:<#(nonnull UIViewController *)#> animated:<#(BOOL)#>
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
